package com.rd.student.jike.class1.guojiabao.Day0731;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Text03 {
    public static void main(String[] args) {
        ArrayList list=new ArrayList();
        for (int i = 0; i < 50; i++) {
            list.add(i);
        }
        int len=list.size();
        for (int i = 0; i < 20; i++) {
            int index = (int) (Math.random() * len);
            System.out.println(list.get(index));
        }
        int[] indexArr1 = new int[len];
        for (int i = 0; i < indexArr1.length; i++) {
            indexArr1[i] = -1;
        }
        for (int i = 0; i < 20; i++) {
            int random = (int) (Math.random() * len);
            if (indexArr1[random] == -1) {
                indexArr1[random] = random;
                System.out.println(list.get(random));
            } else {
                i--;
            }
        }
    }
}
